package com.davetrudes.jung.client.graphics;

public class Font {

	/*
	 * Constants to be used for styles. Can be combined to mix styles.
	 */

	public static enum Style { NORMAL, BOLD, ITALIC };

	public static enum Name { ARIAL };

	/**
	 * The logical name of this <code>Font</code>, as passed to the constructor.
	 *
	 * @since JDK1.0
	 *
	 * @serial
	 * @see #getName
	 */
	protected Name name;

	/**
	 * The style of this <code>Font</code>, as passed to the constructor. This
	 * style can be PLAIN, BOLD, ITALIC, or BOLD+ITALIC.
	 *
	 * @since JDK1.0
	 *
	 * @serial
	 * @see #getStyle()
	 */
	protected Style style;

	/**
	 * The point size of this <code>Font</code>, rounded to integer.
	 *
	 * @since JDK1.0
	 *
	 * @serial
	 * @see #getSize()
	 */
	protected int size;

	public Font(Name name, Style style, int size) {
		this.name = (name != null) ? name : Name.ARIAL;
		this.style = (style != null) ? style : Style.NORMAL;
		this.size = size;

	}

	/**
	 *
	 */
	public Font(){
		this(null, null, 12);
	}



	/**
	 * Returns the logical name of this <code>Font</code>. Use
	 * <code>getFamily</code> to get the family name of the font. Use
	 * <code>getFontName</code> to get the font face name of the font.
	 *
	 * @return a <code>String</code> representing the logical name of this
	 *         <code>Font</code>.
	 * @see #getFamily
	 * @see #getFontName
	 * @since JDK1.0
	 */
	public Name getName() {
		return name;
	}

	/**
	 * Returns the style of this <code>Font</code>. The style can be NORMAL,
	 * BOLD, ITALIC.
	 *
	 * @return the style of this <code>Font</code>
	 */
	public Style getStyle() {
		return style;
	}

	/**
	 * Returns the point size of this <code>Font</code>, rounded to an integer.
	 * Most users are familiar with the idea of using <i>point size</i> to
	 * specify the size of glyphs in a font. This point size defines a
	 * measurement between the baseline of one line to the baseline of the
	 * following line in a single spaced text document. The point size is based
	 * on <i>typographic points</i>, approximately 1/72 of an inch.
	 * <p>
	 * The Java(tm)2D API adopts the convention that one point is equivalent to
	 * one unit in user coordinates. When using a normalized transform for
	 * converting user space coordinates to device space coordinates 72 user
	 * space units equal 1 inch in device space. In this case one point is 1/72
	 * of an inch.
	 *
	 * @return the point size of this <code>Font</code> in 1/72 of an inch
	 *         units.
	 * @see #getSize2D
	 * @see GraphicsConfiguration#getDefaultTransform
	 * @see GraphicsConfiguration#getNormalizingTransform
	 * @since JDK1.0
	 */
	public int getSize() {
		return size;
	}

	/**
	 * Indicates whether or not this <code>Font</code> object's style is PLAIN.
	 *
	 * @return <code>true</code> if this <code>Font</code> has a PLAIN sytle;
	 *         <code>false</code> otherwise.
	 * @see java.awt.Font#getStyle
	 * @since JDK1.0
	 */
	public boolean isPlain() {
		return style == Style.NORMAL;
	}

	/**
	 * Indicates whether or not this <code>Font</code> object's style is BOLD.
	 *
	 * @return <code>true</code> if this <code>Font</code> object's style is
	 *         BOLD; <code>false</code> otherwise.
	 * @see java.awt.Font#getStyle
	 * @since JDK1.0
	 */
	public boolean isBold() {
		return (style == Style.BOLD);
	}

	/**
	 * Indicates whether or not this <code>Font</code> object's style is ITALIC.
	 *
	 * @return <code>true</code> if this <code>Font</code> object's style is
	 *         ITALIC; <code>false</code> otherwise.
	 * @see java.awt.Font#getStyle
	 * @since JDK1.0
	 */
	public boolean isItalic() {
		return (style == Style.ITALIC);
	}
}